Audio and video playback system and method for playing audio data applied thereto

ABSTRACT

An audio and video playback system includes an audio and video playback device having a local audio device, and a secondary audio device. A method for playing audio data includes: allocating a local audio buffer space and a secondary audio buffer space to the local audio device and the secondary audio device, respectively; processing obtained multimedia data to generate local audio data and secondary audio data; writing the local audio data and the secondary audio data to the local audio buffer space and the secondary audio buffer space, respectively; reading the local audio data and the secondary audio data buffered in the local audio buffer space and the secondary audio buffer space to the local audio device and the secondary audio device, to have the local audio device and the secondary audio device play the local audio data and the secondary audio data, respectively.

This application claims the benefit of China application Serial No.201711255348.5, filed Dec. 1, 2017, the subject matter of which isincorporated herein by reference.

BACKGROUND OF THE INVENTION Field of the Invention

The invention relates to a technical field of audio playback, and moreparticularly to an audio and video playback system and a method forplaying audio data applied to the audio and video playback system.

Description of the Related Art

With the development of technologies and increasing daily liferequirements of people, current audio and visual playback devices suchas televisions continue to get smarter and high-end and provide imagesof ever-increasing resolutions as well as robust audio and videodecoding capabilities. However, regarding sound output, two smallspeakers built in a television are still adopted, in a way that theoverall sound effect does not improve much even after sound effectprocessing.

The use of home theaters allow users to experience a stereo surroundscene when watching television. However, purchasing a home theater soundsystem can be quite costly; further, when using the home theater, anaudio playback can be realized only by an external secondary soundsystem rather than fully utilizing an original sound system of thetelevision.

SUMMARY OF THE INVENTION

One main technical problem to be resolved by the present invention ishow to provide an audio and video playback system and a method forplaying audio data applied to the audio and video playback system,allowing a local audio device of an audio and video playback device anda secondary audio device to jointly play audio data in multimedia data.

To resolve the above technical problem, the present invention provides amethod for playing audio data applied to an audio and video playbacksystem. The audio and video playback system includes an audio and videoplayback device having a local audio device, and a secondary audiodevice. The method includes: allocating a local audio buffer space and asecondary audio buffer space to the local audio device and the secondaryaudio device, respectively; processing obtained multimedia data togenerate local audio data and secondary audio data; writing the localaudio data and the secondary audio data to the local audio buffer spaceand the secondary audio buffer space, respectively; reading the localaudio data and the secondary audio data buffered in the local audiobuffer space and the secondary audio buffer space to the local audiodevice and the secondary audio device, respectively, to have the localaudio device and the secondary audio device play the local audio dataand the secondary audio data, respectively.

To resolve the above technical problem, the present invention providesan audio and video playback system. The audio and video playback systemincludes: an audio and video playback device, playing multimedia data,the audio and video playback device including a local audio device, aprocessor, a memory and a buffer unit; and a secondary audio device,connected to the audio and video playback device. The memory of theaudio and video playback device is stored with an audio devicemanagement program. When the audio device management program isexecuted, the audio and video playback device controls the local audiodevice and the secondary audio device for a collaborated playback taskaccording to the audio device management program to play the audio datain the multimedia data.

The present invention provides the following effects. Different from theprior art, in the method for playing audio data applied to the audio andvideo playback system of the present invention, a local audio bufferspace and a secondary audio buffer space are allocated to the localaudio device and the secondary audio device, respectively, local audiodata and secondary audio data generated by processing multimedia dataare written to the local audio buffer space and the secondary audiobuffer space, respectively, so as to play the local audio data and thesecondary audio data by the local audio device and the secondary audiodevice, respectively. Thus, in the audio and video playback system, thelocal audio device of the audio and video playback device and thesecondary audio device can jointly play audio data in the multimediadata.

The above and other aspects of the invention will become betterunderstood with regard to the following detailed description of thepreferred but non-limiting embodiments. The following description ismade with reference to the accompanying drawings.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a flowchart of a method for playing audio data applied to anaudio and video playback system according to an embodiment of thepresent invention;

FIG. 2 is a flowchart of a method for playing audio data applied to anaudio and video playback system according to another embodiment of thepresent invention;

FIG. 3 is a detailed flowchart of step S21 in FIG. 2;

FIG. 4 is a detailed flowchart of step S22 in FIG. 2;

FIG. 5 is a detailed flowchart of step S222 in FIG. 4;

FIG. 6 is a detailed flowchart of step S22 in FIG. 2;

FIG. 7 is a detailed flowchart of step S225 in FIG. 6;

FIG. 8 is a schematic diagram of a frame of an audio and video playbacksystem according to an embodiment of the present invention;

FIG. 9 is a flowchart of steps performed by a processor 112 of an audioplayback device 11 in an audio and video playback system according to anembodiment of the present invention;

FIG. 10 is a flowchart of steps performed by a processor 112 of an audioplayback device 11 in an audio and video playback system according to anembodiment of the present invention;

FIG. 11 is a detailed flowchart of step S41 in FIG. 10 and performed bythe processor 112;

FIG. 12 is a detailed flowchart of step S42 in FIG. 10 and performed bythe processor 112; and

FIG. 13 is a detailed flowchart of step S42 in FIG. 10 and performed bythe processor 112.

DETAILED DESCRIPTION OF THE INVENTION

Specific details are given in the description below in order tothoroughly understand the present invention. However, the presentinvention can be implemented by various other methods different fromthose described below, and a person skilled in the art can make similararrangements without departing from the spirit of the present invention.Therefore, the present invention is not limited by the embodimentsdisclosed below.

It should be noted that, a current audio and video playback device suchas a smart television usually has capabilities for decoding Dolbydigital surround sound and DTS digital surround sound, and is capable ofdecoding multi-channel pulse code modulation data, such as data of 5.1channels, i.e., a center channel, front left and right channels, andleft and right surround channels, and a subwoofer channel (i.e., Cl, L,R, Ls, Rs and LFE channels). However, due to a limited output capabilityof a local audio device, for example, a smart television is usuallyequipped with only two small speakers, the output of only the front leftchannel and the front right channel can be achieved rather thanoutputting a multi-path stereo surround sound.

Therefore, when using an audio and video playback device for audio andvideo playback, an external audio device capable of achieving multi-pathoutput is frequently connected to the audio and video playback device tooutput audio, so as to realize the effect of stereo surround sound andsatisfy user needs. However, purchasing the above external audio devicecapable of realizing multi-path sound output can be quite costly. Inaddition, such method of directly using the external audio device foraudio output does not fully utilize a local audio device of the audioand video playback device.

In regard to the drawbacks mentioned in the description of the priorart, the present invention provides an audio and video playback systemand a method for playing audio data applied to the audio and videoplayback system. The present invention is described in detail in theembodiments with reference to the accompanying drawings below.

FIG. 1 shows a flowchart of a method for playing audio data applied toan audio and video playback system according to an embodiment of thepresent invention.

In this embodiment, an audio and video playback system is furtherprovided with a secondary audio device on the basis of an audio andvideo playback device having a local audio device, such that the localaudio device and the secondary audio device can collaborate to jointlyplay corresponding audio data.

The audio and video playback device refers to a device that can playboth audio and video, and is, for example, a computer, a cell phone, anin-vehicle computer, a television, or a television system consisting ofa set-top box (STB) and a television.

The local audio device is a playback device capable of outputting audiodata, and is for example, an acoustic enclosure or a speaker. The localaudio device serves as a part of the audio and video playback device andis provided in the audio and video playback device to enable the audioand video playback device to independently play audio.

The secondary audio device is an audio playback device externallyconnected by a certain means to the audio and video playback device, andis an audio device, for example, an acoustic enclosure or a speaker,capable of independently playing corresponding audio data or playingcorresponding audio data together with the local audio device whencontrolled by an audio playback device. More specifically, the secondaryaudio device may be connected by a wired or wireless means, e.g., USBwired connection, WiFi connection, 5.4G protocol and Bluetoothconnection.

In an application scenario, the audio playback device is a television,or a television system consisting of an STB and a television. The localaudio device is a local speaker built in the television, and thesecondary audio device is an external acoustic enclosure connected to atelevision by means of USB wireless connection.

In this embodiment, the audio and video playback device is capable ofprocessing multi-channel audio data, e.g., decoding audio datacorresponding to stereophonic, four surround, 5.1 channel or 7.1channel. The local audio device and the secondary audio device may eachbe a playback device capable of outputting audio data of one singlechannel or multiple different channels. For example, the local audiodevice and the secondary audio device can both output audio datacorresponding to one or more channels in 5.1 channel data. Morespecifically, the two can be complementary so as to output audio datacorresponding to all channels of 5.1 channel data.

In one application scenario, the local audio device can output audiodata corresponding to the front left and right channels; the secondaryaudio device is complementary with the local audio device and can outputaudio data corresponding to the center channel, the left and rightsurround channels and the subwoofer channel. Thus, with collaboratedplayback of the two audio devices, the audio and video playback systemcan completely realize 5.1 channel audio data output.

In this embodiment, the method for playing audio data includes thefollowing steps.

In step S11, a local audio buffer space and a secondary audio bufferspace are allocated to the local audio device and the secondary audiodevice, respectively.

The local audio buffer space is mainly for buffering local audio datathat can be outputted by the local audio device, and the secondary audiobuffer space is mainly for buffering secondary audio data that can beoutputted by the secondary audio device. More specifically, capacitiesof the local audio buffer space and the secondary audio buffer space canbe system-predetermined values, or may be user-defined values accordingto different playback requirements.

In step S12, obtained multimedia data is processed to generate localaudio data and secondary audio data.

The multimedia data is multimedia data including audio data that can beplayed by the audio and video playback system, e.g., video dataincluding audio, or pure audio data. The audio data in the multimediadata may be multi-channel audio data. Further, the multimedia data maybe downloaded from a cloud terminal, a local memory of the audio andvideo playback device, or acquired on-site.

The local audio data and the secondary audio data are audio datagenerated from processing the multimedia data by the video and audioplayback system. More specifically, the local audio data is audio datathat is generated from processing the multimedia data and can beoutputted by the local audio device. Correspondingly, the secondaryaudio data is audio data that is generated from processing themultimedia data and can be outputted by the secondary audio device. Forexample, when the local audio device can output only audio datacorresponding to the front left and right channels, the local audio datamay be at least one of audio data corresponding to the front leftchannel and audio data corresponding to the front right channel.

That is to say, processing the obtained multimedia data to generate thelocal audio data and the secondary audio data can be processingmulti-channel audio data in the obtained multimedia data—the obtainedaudio data corresponding to the channel that can be outputted by thelocal audio device is used as the local audio data, and the obtainedaudio data corresponding to the channel that can be outputted by thesecondary audio device is used as the secondary audio data.

In step S13, the local audio data and the secondary audio data arewritten to the local audio buffer space and the secondary audio bufferspace, respectively.

In step S14, the local audio data and the secondary audio data are readfrom the local audio buffer space and the secondary audio buffer spaceto the local audio device and the secondary audio device, respectively,to have the local audio device and the secondary audio device play thelocal audio data and the secondary audio data, respectively.

It should be noted that, the capacities of the local audio buffer spaceand the secondary audio buffer space are consistent and may bedetermined according to actual requirements, for example, determinedwith reference to a speed of writing the audio data and a speed ofoutputting the audio data, given that a balance between writing andreading the audio data is maintained and the output of the audio datacan be smoothly performed.

In this embodiment, the local audio buffer space and the secondary audiobuffer space are correspondingly allocated to the local audio device andthe secondary audio device, respectively, such that the correspondinglocal audio data and secondary audio data can be written and buffered,so as to further readily read the corresponding local audio data andsecondary audio data to the local audio device and the secondary audiodevice according to requirements.

In one application scenario, the local audio buffer space and thesecondary audio buffer space are respectively ring buffer spaces. Morespecifically, a first-in-first-out (FIFO) buffer mechanism may be usedto respectively buffer the corresponding local audio data and secondaryaudio data. Thus, while reading the local audio data and the secondaryaudio data buffered in the local audio buffer space and the secondaryaudio buffer space to the local audio device and the secondary audiodevice, more local audio data and secondary audio data can be furtherwritten to the local audio buffer space and the secondary audio bufferspace, respectively.

In one embodiment, a method for playing audio data applied to an audioand video playback system according to an embodiment of the presentinvention further includes the following.

In step S21, it is determined whether the local audio data and thesecondary audio data outputted from the local audio device and thesecondary audio device are synchronous.

It is understandable that, when the local audio device and the secondaryaudio device need to simultaneously output audio data corresponding todifferent channels of the same multimedia data, the sound effect wouldbe poor if the audio of the channels cannot be synchronously outputted.However, for different audio devices, due to delays at output ends anddifferent sample rates, synchronous output of audio can be quitechallenging. Thus, before outputting audio, it needs to be determinedwhether the local audio data and the secondary audio data outputted fromthe local audio device and the secondary audio device are synchronous,and to timely make adjustment if the local audio data and the secondaryaudio data are asynchronous.

More specifically, referring to FIG. 3, step S21 includes the following.

In sub-step S211, delay periods of the local audio data and thesecondary audio data outputted from the local audio device and thesecondary audio device are acquired, respectively.

A delay is frequently present at an output end when an audio deviceoutputs audio data, and delay periods at output ends of different audiodevices are different, such that audio outputted from different audiodevices is asynchronous. For example, for an Android-based smarttelevision, local audio data (e.g., audio data played by speakers builtin the television) is processed by executing“AudioHal->tinyalsa->ALSA->DSP->DAC->SPEAKER/HP” by a bottom-layerprocessing mechanism and outputted, and it is discovered through teststhat such processing and outputting processes require a delay period of74 to 90 ms; audio data (e.g., audio data outputted using a secondaryUSB audio device connected to the smart television) is processed byexecuting “AudioHal->tinyalsa-USB ALSA->USB Driver->USB ICprocess->wireless protocol->speaker” and outputted, and it is discoveredthrough tests that such processing and outputting processes require adelay period of 120 to 150 ms. Thus, when using the audio device or thetelevision and the USB audio device to jointly perform audio output, theaudio device of the television having a shorter delay period outputs theaudio earlier than the USB audio device having a longer delay period,resulting in asynchronous output between the two. That is to say,because the local audio device and the secondary audio device aredifferent audio devices, outputting audio of different channels cannotbe synchronously performed when the two jointly output audio data.

Therefore, delay periods of the local audio data and the secondary audiodata outputted from the local audio device and the secondary audiodevice need to detected, respectively.

When the delay periods of the local audio data and the secondary audiodata outputted from the local audio device and the secondary audiodevice are tested, such delay periods basically cannot be perceived bythe human ear. In this embodiment, a delayer can be used for thedetection, or software can also be used. For example, the detection isperformed by using SIA electroacoustic test software or other means, andis not limited to the above examples.

In sub-step S212, it is determined whether the local audio data and thesecondary audio data outputted from the local audio device and thesecondary audio device are synchronous according to the delay periods ofthe local audio data and the secondary audio data outputted from thelocal audio device and the secondary audio device.

In this embodiment, after the above detection and comparison, when thedelay periods between the local audio data and the secondary audio dataoutputted from the local audio device and the secondary audio devicehave been detected, it is determined that the local audio data and thesecondary audio data outputted from the local audio device and thesecondary audio device are synchronous if the two are the same, ordiffer by within a tolerable difference range. When the two aredifferent by beyond the tolerable range, it is determined that the localaudio data and the secondary audio data outputted from the local audiodevice and the secondary audio device are asynchronous.

In step S22, when it is determined that the local audio data and thesecondary audio data outputted from the local audio device and thesecondary audio device are asynchronous, a synchronization mechanism isexecuted to synchronize the local audio data and the secondary audiodata outputted from the local audio device and the secondary audiodevice.

It is understandable that, when the local audio data and the secondaryaudio data outputted from the local audio device and the secondary audiodevice are asynchronous, through certain means, the audio device thatoutputs audio earlier can be delayed by a certain period to outputaudio, or the audio device that outputs audio later can be broughtforward to output audio.

More specifically, in one application scenario, referring to FIG. 4,step S22 includes the following.

In sub-step S221, a difference between the delay periods of the localaudio data and the secondary audio data outputted from the local audiodevice and the secondary audio device is determined.

After the delay periods of the local audio data and the secondary audiodata outputted from the local audio device and the secondary audiodevice are acquired by using a delayer or detection software, thedifference between the two delay periods can be determined throughsimple calculation.

In sub-step S222, a null packets having a corresponding size isgenerated according to the difference between the delay periods of thelocal audio data and the secondary audio data outputted from the localaudio device and the secondary audio device.

The null packet refers to a packet that does not include any audio data;that is, when the corresponding audio data reads the null packet, nosound is outputted.

More specifically, in an application scenario, referring to FIG. 5,sub-step S222 further includes sub-steps S2221 and S2222.

In sub-step S2221, it is determined whether the difference between thedelay periods of the local audio data and the secondary audio dataoutputted from the local audio device and the secondary audio device isgreater than a predetermined value.

It should be noted that, the predetermined value in this embodiment canbe a predetermined time value of the audio and video playback system ora user-defined time value. When the difference between the delay periodsof the local audio data and the secondary audio data outputted from thelocal audio device and the secondary audio device is smaller than thepredetermined value, a user cannot perceive a difference caused by thedifferent delay periods between the local audio device and the secondaryaudio device. However, when the difference between the delay periods ofthe local audio data and the secondary audio data outputted from thelocal audio device and the secondary audio device is greater than thepredetermined value, a user can perceive the difference caused by thedifferent delay periods between the local audio device and the secondaryaudio device, which means, at this point, the outputted sound effect ispoor and adjustment needs to be made.

In sub-step S2222, when the difference between the delay periods of thelocal audio data and the secondary audio data outputted from the localaudio device and the secondary audio device is greater than thepredetermined value, a null packet having a corresponding size isgenerated according to the difference between the delay periods of thelocal audio data and the secondary audio data outputted from the localaudio device and the secondary audio device.

In this embodiment, the size of the null packet corresponds to thedifference between the delay periods of the local audio data and thesecondary audio data outputted from the local audio device and thesecondary audio device, and more specifically, the time used foroutputting the null packet by the audio device is equal to thedifference in the delay periods.

In sub-step S223, the null packet is written to the local audio bufferspace or the secondary audio buffer space corresponding to the localaudio device or the secondary audio device having the smaller delayperiod, such that the local audio device or the secondary audio deviceoutputs the null packet when outputting the local audio data or thesecondary audio data, thus synchronizing the local audio data and thesecondary audio data outputted from the local audio device and thesecondary audio device.

After acquiring the delay periods of the local audio data and thesecondary audio data outputted from the local audio device and thesecondary audio device, the audio device corresponding to the smallerdelay period and the corresponding difference in the delay periods canbe obtained.

As described, the size of the null packet corresponds to the differencein the delay periods. Thus, when the corresponding local audio data andsecondary audio data are respectively read by the local audio device andthe secondary audio device, the null packet can be outputted at afront-end of the audio device having the smaller delay period. As such,when the time that the audio device having the smaller delay period usesto output the null packet is equal to the corresponding difference inthe delay periods, the local audio device and the secondary audio devicecan simultaneously start outputting the corresponding local audio dataand secondary audio data after the null packet is outputted from theaudio device having the smaller delay period, thereby achievingsynchronous output of the local audio data and the secondary audio datafrom the local audio device and the secondary audio device.

In an application scenario, the audio and video playback device is atelevision, the local audio device is a built-in speaker, and thesecondary audio device is an acoustic enclosure connected by means ofUSB wireless connection. Assume that the sound of the television speakermeasured using an instrument by a user is 30 ms ahead, and cannot besynchronously outputted with the sound of a USB speaker. At this point,the delay period of the television speaker is set to 30 ms; in anexecution thread written in the television speaker, a data amount iscalculated according to a sample rate, sound channels, a bit rate and adelay period of the television speaker when the delay period of thetelevision speaker is not equal to zero, and null data having the dataamount is filled in a ring buffer space of the television speaker. Thus,the ring buffer space of the television speaker has a data amount of 30ms more than that in the ring buffer space of the USB speaker, the soundis continuous, the speed of writing the corresponding audio data isconstant, and the television speaker then buffers the data in the ringbuffer space. As a result, the sound of the television speaker isdelayed before being outputted, and is kept synchronous with the soundof the USB speaker.

In another application scenario, referring to FIG. 6, step S22 includesthe following.

In sub-step S224, a difference between the delay periods of the localaudio data and the secondary audio data outputted from the local audiodevice and the secondary audio device is determined.

In sub-step S225, a corresponding data size is obtained according to thedifference between the delay periods of the local audio data and thesecondary audio data outputted from the local audio device and thesecondary audio device.

Other details of this application scenario are similar to the previousapplication scenario, and can be referred from the descriptionassociated with the previous scenario and are thus omitted herein.

Meanwhile, the corresponding data size obtained is similar to the sizeof the null packet; the corresponding data size may be correspondinglyequal to the difference between the delay periods, and may becorrespondingly smaller than or equal to a difference between thedifference of the delay times and the above predetermined value.

More specifically, in an application scenario, referring to FIG. 7,sub-step S225 further includes sub-steps S2251 and S2252.

In sub-step S2251, it is determined whether a difference between thedelay periods of the local audio data and the secondary audio dataoutputted from the local audio device and the secondary audio device isgreater than a predetermined value.

In sub-step S2252, when the difference between the time periods of thelocal audio data and the secondary audio data outputted from the localaudio device and the secondary audio device is greater than thepredetermined value, a corresponding data size is calculated andobtained according to the difference between the delay periods of thelocal audio data and the secondary audio data outputted from the localaudio device and the secondary audio device.

Similarly, details of the sub-step S225 can be referred from thedescription associated with the previous application scenario, and areomitted herein.

In sub-step S226, data having a corresponding data size is discardedfrom the local audio buffer space or secondary audio buffer spacecorresponding to the local audio device or the secondary audio devicehaving a greater delay period, so as to synchronize the local audio dataand the secondary audio data outputted from the local audio device andthe secondary audio device.

As described, the data size obtained corresponds to the difference inthe delay periods. Thus, when the corresponding local audio data andsecondary audio data are respectively read by the local audio device andthe secondary audio device, data corresponding to the above data sizecan be discarded from a front part of the local audio data or thesecondary audio data corresponding to the local audio device or thesecondary audio device having a greater delay period, i.e., the data atthe front part is not outputted from the corresponding audio device. Assuch, the time used by the audio device to output the part of discardeddata is correspondingly equal to the difference in the delay periods,the audio device having a greater delay period can catch up in readingthe audio data corresponding to the audio device having a smaller delayperiod after discarding the part of the data, and the local audio deviceand the secondary audio device can then simultaneously start to read thecorresponding local audio data and secondary audio data from the datafollowing the discarded data, thereby synchronizing the local audio dataand the secondary audio data outputted from the local audio device andthe secondary audio device.

In an application scenario, the audio and video playback device is atelevision, the local audio device is a built-in speaker, and thesecondary audio device is an acoustic enclosure connected by means ofUSB wireless connection. Although the USB acoustic enclosure provides asample rate of 48 KHz, the actual hardware output is approximately 47.98KHz. It is discovered through tests by a user that, after the outputs ofthe television speaker and the USB acoustic enclosure are synchronizedand a source is played continuously for 30 minutes, asynchronizationagain occurs. More specifically, the audio output from the televisionspeaker is faster than the audio output from the USB acoustic enclosureby 50 ms, and such difference increases as the playback continues,resulting in significant synchronization discrepancy. At this point,after detection, it is concluded that the data size of data buffered inthe ring buffer space can skip the playback time of the device, and the50 ms data is directly discarded and not outputted. Although the soundmay sound a little paused, such issue cannot be easily perceived by auser because the surround sound of the audio outputted from the USBacoustic enclosure is not the main sound. Thus, synchronous output ofthe local audio data and the secondary audio data from the local audiodevice and the secondary audio device is achieved.

With the above method, a local audio buffer space and a secondary audiobuffer space are respectively allocated to the local audio device andthe secondary audio device. When the local audio data and the secondaryaudio data outputted from the local audio device and the secondary audiodevice are asynchronous, a null packet can be written to the local audiobuffer space or the secondary audio buffer space corresponding to thelocal audio device or the secondary audio device having a smaller delayperiod, or data having a corresponding data size is discarded from thelocal audio buffer space or the secondary audio buffer spacecorresponding to the local audio device or the secondary audio devicehaving a greater delay period, thereby synchronizing the local audiodata and the secondary audio data outputted from the local audio deviceand the secondary audio device. Meanwhile, in contribution of thecollaboration of the local audio device and the secondary audio device,the processed multimedia data is outputted through multiple channels,thus achieving a stereo surround sound effect. Further, in thisembodiment, the local audio device of the audio and video playbackdevice is fully utilized without having to entirely depend on anexternal secondary audio device, hence significantly reducingutilization costs.

FIG. 8 shows a schematic diagram of a frame of an audio and videoplayback system according to an embodiment of the present invention. Theaudio and video playback system includes an audio video playback device11 and a secondary audio device 12.

The audio and video playback device 11 is for playing multimedia data,and includes a local audio device 111, a processor 112, a memory 113 anda buffer unit 114. The secondary audio device 12 is connected to theaudio and video playback device 11.

In an application scenario, the audio and video playback device 11 is atelevision or a television system consisting of an STB and a television,the local audio device 11 is a local speaker built-in the television,and the secondary audio device 12 and the television are connected bymeans of USB wireless connection.

The memory 113 of the audio and video playback device 11 is stored withan audio device management program. When the audio device managementprogram is executed by the processor 112, the audio and video playbackdevice 11 controls the local audio device and the secondary audio devicefor a collaborated playback task according to the audio devicemanagement program to play the audio data in the multimedia data.

In addition, the audio device management program further includes anaudio device playback mode selection function. When the audio deviceplayback mode selection function is performed, the audio and videoplayback device 11 drives the local audio device 111 and/or thesecondary audio device 12 according to the selected audio deviceplayback mode to play the audio data in the multimedia data.

That is to say, in this embodiment, the audio and video playback systemcan drive only the local audio device 11 to play the audio data in themultimedia data, drive only the secondary audio device 12 for playback,and simultaneously drive the local audio device 111 and the secondaryaudio device 12 for collaborated playback.

More specifically, other details of the audio and video playback device11, the local audio device 111 and the secondary audio device 12 aresimilar to those in the foregoing description associated with the methodfor playing the audio data applied to an audio and video playback systemof the present invention, and can be referred from the above embodimentsand are thus omitted herein.

In one embodiment, referring to FIG. 9, when the audio and videoplayback device 11 controls the local audio device 111 and the secondaryaudio device 12 according to the audio device management program tocollaboratively play the audio data in the multimedia data, theprocessor 112 in the audio and video playback device 11 performs thefollowing.

In step S31, from the buffer unit 114, a local audio buffer space and asecondary audio buffer space are allocated to the local audio device 111and the secondary audio device 12, respectively.

In step S32, obtained multimedia data is processed to generate localaudio data and secondary audio data.

In step S33, the local audio data and the secondary audio data arewritten to the local audio buffer space and the secondary audio bufferspace, respectively.

In step S34, the local audio data and the secondary audio data bufferedin the local audio buffer space and the secondary audio buffer space areread to the local audio device 111 and the secondary audio device 12,respectively, to have the local audio device 111 and the secondary audiodevice 12 play the local audio data and the secondary audio data,respectively.

In one embodiment, the local audio buffer space and the secondary audiobuffer space are respectively ring buffer spaces. More specifically, afirst-in-first-out (FIFO) buffer mechanism may be used to respectivelybuffer the local audio data and the secondary audio data. Thus, whilereading the local audio data and the secondary audio data buffered inthe local audio buffer space and the secondary audio buffer space to thelocal audio device 111 and the secondary audio device 12, more localaudio data and secondary audio data can be further written to the localaudio buffer space and the secondary audio buffer space, respectively.

Referring to FIG. 10, in one embodiment, when the audio and videoplayback device 11 controls the local audio device 111 and the secondaryaudio device 12 to collaboratively play the audio data in the multimediadata, the processor 112 further performs the following.

In step S41, it is determined whether the local audio data and thesecondary audio data outputted from the local audio device 111 and thesecondary audio device 12 are synchronous.

In step S42, when it is determined that the local audio data and thesecondary audio data outputted from the local audio device 111 and thesecondary audio device 12 are asynchronous, a synchronization mechanismis executed to synchronize the local audio data and the secondary audiodata outputted from the local audio device 111 and the secondary audiodevice 12.

Referring to FIG. 11, in one embodiment, step S41 further comprises thefollowing.

In step S411, delay periods of the local audio data and the secondaryaudio data outputted from the local audio device 111 and the secondaryaudio device 12 are acquired, respectively.

In step S412, according to the respective delay periods of the localaudio data and the secondary audio data outputted from the local audiodevice 111 and the secondary audio device 12, it is determined whetherthe local audio data and the secondary audio data outputted from thelocal audio device 111 and the secondary audio device 12 aresynchronous.

Referring to FIG. 12, in one embodiment, step S42 further includes thefollowing.

In step S421, a difference between the delay periods of the local audiodata and the secondary audio data outputted from the local audio device111 and the secondary audio device 12 is determined.

In step S422, a null packet having a corresponding size is generatedaccording to the difference between the delay periods of the local audiodata and the secondary audio data outputted from the local audio device111 and the secondary audio device 12.

In step S423, the null packet is written to the local audio buffer spaceor the secondary audio buffer space corresponding to the local audiodevice 111 or the secondary audio device 12 having a smaller delayperiod, such that the local audio device 111 or the secondary audiodevice 12 outputs the null packet when outputting the local audio dataor the secondary audio data, thereby synchronizing the local audio dataand the secondary audio data outputted from the local audio device 111and the secondary audio device 12.

Referring to FIG. 13, in one embodiment, step S42 further includes thefollowing.

In step S424, a difference between the delay periods of the local audiodata and the secondary audio data outputted from the local audio device111 and the secondary audio device 12 is determined.

In step S425, a corresponding data size is obtained according to thedifference between the delay periods of the local audio data and thesecondary audio data outputted from the local audio device 111 and thesecondary audio device 12.

In step S426, data having the corresponding data size is discarded fromthe local audio buffer space or the secondary audio buffer spacecorresponding to the local audio device 111 or the secondary audiodevice 12, thereby synchronizing the local audio data and the secondaryaudio data outputted from the local audio device 111 and the secondaryaudio device 12.

Similarly, in the audio and video playback system according to thisembodiment, the steps performed by the audio and video playback systemare similar to the foregoing method for playing audio data applied to anaudio and video playback system of the present invention, and associateddetails can be referred from the description of the above embodimentsand are omitted herein.

With the above method, a local audio buffer space and a secondary audiobuffer space are respectively allocated to the local audio device 111and the secondary audio device 12. When the local audio data and thesecondary audio data outputted from the local audio device 111 and thesecondary audio device 12 are asynchronous, a null packet is written tothe local audio buffer space or the secondary audio buffer spacecorresponding to the local audio device 111 or the secondary audiodevice 12 having a smaller delay period, or data having a correspondingdata size is discarded from the local audio buffer space or thesecondary audio buffer space corresponding to the local audio device 111or the secondary audio device 12 having a greater delay period, therebysynchronizing the local audio data and the secondary audio dataoutputted from the local audio device 111 and the secondary audio device12. Meanwhile, in contribution of the collaboration of the local audiodevice 111 and the secondary audio device 12, the processed multimediadata is outputted through multiple channels, thus achieving a stereosurround sound effect. Further, in this embodiment, the local audiodevice 111 of the audio and video playback device 11 is fully utilizedwithout having to entirely depend on an external secondary audio device12, hence significantly reducing utilization costs.

While the invention has been described by way of example and in terms ofthe preferred embodiments, it is to be understood that the invention isnot limited thereto. On the contrary, it is intended to cover variousmodifications and similar arrangements and procedures, and the scope ofthe appended claims therefore should be accorded with the broadestinterpretation so as to encompass all such modifications and similararrangements and procedures.

What is claimed is:
 1. A method for playing audio data, the methodapplied to an audio and video playback system, the audio and videoplayback system comprising a secondary audio device and an audio andvideo playback device having a local audio device, wherein the audio andvideo playback device plays both audio and video, the method comprising:allocating a local audio buffer space and a secondary audio buffer spaceto the local audio device and the secondary audio device, respectively;processing obtained multimedia data to generate local audio data andsecondary audio data; writing the local audio data and the secondaryaudio data to the local audio buffer space and the secondary audiobuffer space, respectively, wherein the local audio data and thesecondary audio data are not the same; reading the local audio data andthe secondary audio data buffered in the local audio buffer space andthe secondary audio buffer space to the local audio device and thesecondary audio device, respectively, to have the local audio device andthe secondary audio device simultaneously play the local audio data andthe secondary audio data, respectively, wherein the local audio bufferspace and the secondary audio buffer space are each a ring buffer space,such that while the local audio data and the secondary audio databuffered in the local audio buffer space and the secondary audio bufferspace are read to the local audio device and the secondary audio device,the local audio data and the secondary audio data are continuouslyfurther written to the local audio buffer space and the secondary audiobuffer space, respectively; and determining whether the local audio dataand the secondary audio data outputted from the local audio device andthe secondary audio device are synchronous; when it is determined thatthe local audio data and the secondary audio data outputted from thelocal audio device and the secondary audio device are asynchronous,executing a synchronization mechanism to synchronize the local audiodata and the secondary audio data outputted from the local audio deviceand the secondary audio device are synchronous; wherein the step ofdetermining whether the local audio data and the secondary audio dataoutputted from the local audio device and the secondary audio device aresynchronous further comprises: acquiring delay periods of the localaudio data and the secondary audio data outputted from the local audiodevice and the secondary audio device, respectively; and determining,according to the respective delay periods of the local audio data andthe secondary audio data outputted from the local audio device and thesecondary audio device, whether the local audio data and the secondaryaudio data outputted from the local audio device and the secondary audiodevice are synchronous; wherein the step of executing thesynchronization mechanism to synchronize the local audio data and thesecondary audio data outputted from the local audio device and thesecondary audio device further comprises: determining a differencebetween the delay periods of the local audio data and the secondaryaudio data outputted from the local audio device and the secondary audiodevice; generating a null packet having a corresponding size accordingto the difference between the delay periods of the local audio data andthe secondary audio data outputted from the local audio device and thesecondary audio device; and writing the null packet to the local audiobuffer space or the secondary audio buffer space corresponding to thelocal audio device or the secondary audio device having the smallerdelay period, to cause the local audio device or the secondary audiodevice to output the null packet when outputting the local audio data orthe secondary audio data, thereby synchronizing the local audio data andthe secondary audio data outputted from the local audio device and thesecondary audio device.
 2. The method according to claim 1, wherein thestep of generating the null packet having the corresponding sizeaccording to the difference between the delay periods of the local audiodata and the secondary audio data outputted from the local audio deviceand the secondary audio device comprises: determining whether thedifference between the delay periods of the local audio data and thesecondary audio data outputted from the local audio device and thesecondary audio device is greater than a predetermined value; and whenthe difference between the delay periods of the local audio data and thesecondary audio data outputted from the local audio device and thesecondary audio device is greater than the predetermined value,generating the null packet having the corresponding size according tothe difference between the delay periods of the local audio data and thesecondary audio data outputted from the local audio device and thesecondary audio device.
 3. A method for playing audio data, the methodapplied to an audio and video playback system, the audio and videoplayback system comprising a secondary audio device and an audio andvideo playback device having a local audio device, wherein the audio andvideo playback device plays both audio and video, the method comprising:allocating a local audio buffer space and a secondary audio buffer spaceto the local audio device and the secondary audio device, respectively;processing obtained multimedia data to generate local audio data andsecondary audio data; writing the local audio data and the secondaryaudio data to the local audio buffer space and the secondary audiobuffer space, respectively, wherein the local audio data and thesecondary audio data are not the same; reading the local audio data andthe secondary audio data buffered in the local audio buffer space andthe secondary audio buffer space to the local audio device and thesecondary audio device, respectively, to have the local audio device andthe secondary audio device simultaneously play the local audio data andthe secondary audio data, respectively; wherein the local audio bufferspace and the secondary audio buffer space are each a ring buffer space,such that while the local audio data and the secondary audio databuffered in the local audio buffer space and the secondary audio bufferspace are read to the local audio device and the secondary audio device,the local audio data and the secondary audio data are continuouslyfurther written to the local audio buffer space and the secondary audiobuffer space, respectively; and determining whether the local audio dataand the secondary audio data outputted from the local audio device andthe secondary audio device are synchronous; when it is determined thatthe local audio data and the secondary audio data outputted from thelocal audio device and the secondary audio device are asynchronous,executing a synchronization mechanism to synchronize the local audiodata and the secondary audio data outputted from the local audio deviceand the secondary audio device are synchronous; wherein the step ofdetermining whether the local audio data and the secondary audio dataoutputted from the local audio device and the secondary audio device aresynchronous further comprises: acquiring delay periods of the localaudio data and the secondary audio data outputted from the local audiodevice and the secondary audio device, respectively; and determining,according to the respective delay periods of the local audio data andthe secondary audio data outputted from the local audio device and thesecondary audio device, whether the local audio data and the secondaryaudio data outputted from the local audio device and the secondary audiodevice are synchronous, wherein the step of executing thesynchronization mechanism to synchronize the local audio data and thesecondary audio data outputted from the local audio device and thesecondary audio device further comprises: determining a differencebetween the delay periods of the local audio data and the secondaryaudio data outputted from the local audio device and the secondary audiodevice; obtaining a corresponding data size according to the differencebetween the delay periods of the local audio data and the secondaryaudio data outputted from the local audio device and the secondary audiodevice; and discarding data having the corresponding data size from thelocal audio buffer space or the secondary audio buffer spacecorresponding to the local audio device or the secondary audio devicehaving the greater delay period, thereby synchronizing the local audiodata and the secondary audio data outputted from the local audio deviceand the secondary audio device.
 4. The method according to claim 3,wherein the step of obtaining the corresponding data size according tothe difference between the delay periods of the local audio data and thesecondary audio data outputted from the local audio device and thesecondary audio device further comprises: determining whether thedifference between the delay periods of the local audio data and thesecondary audio data outputted from the local audio device and thesecondary audio device is greater than a predetermined value; and whenthe difference between the delay periods of the local audio data and thesecondary audio data outputted from the local audio device and thesecondary audio device is greater than the predetermined value,obtaining the corresponding data size according to the differencebetween the delay periods of the local audio data and the secondaryaudio data outputted from the local audio device and the secondary audiodevice.
 5. The method according to claim 1, wherein the audio and videoplayback device is a television or a television system consisting of aset-top box (STB) and a television, the local audio device is a localspeaker built in the television, and the secondary audio device is anexternal acoustic enclosure connected to the television.
 6. The methodaccording to claim 5, wherein the secondary audio device and thetelevision are connected by means of USB wireless connection.
 7. Anaudio and video playback system, comprising: an audio and video playbackdevice, for playing multimedia data, the audio and video playback devicecomprising a local audio device, a processor, a memory and a bufferunit, wherein the audio and video playback device plays both audio andvideo; and a secondary audio device, connected to the audio and videoplayback device; wherein the processor in the audio and video playbackdevice performs steps of: allocating a local audio buffer space and asecondary audio buffer space to the local audio device and the secondaryaudio device, respectively; processing the obtained multimedia data togenerate local audio data and secondary audio data; writing the localaudio data and the secondary audio data to the local audio buffer spaceand the secondary audio buffer space, respectively; and reading thelocal audio data and the secondary audio data buffered in the localaudio buffer space and the secondary audio buffer space to the localaudio device and the secondary audio device, respectively, to have thelocal audio device and the secondary audio device simultaneously playthe local audio data and the secondary audio data, respectively;wherein, an audio device management program is stored in the memory ofthe audio and video playback device; when the audio device managementprogram is executed, the audio and video playback device controls thelocal audio device and the secondary audio device according to the audiodevice management program to perform a collaborated playback task toplay audio data in the multimedia data; wherein when the audio and videoplayback device controls the local audio device and the secondary audiodevice according to the audio device management program to perform thecollaborated playback task to play audio data in the multimedia data;wherein the local audio buffer space and the secondary audio bufferspace are each a ring buffer space, such that while the local audio dataand the secondary audio data buffered in the local audio buffer spaceand the secondary audio buffer space are read to the local audio deviceand the secondary audio device, the local audio data and the secondaryaudio data are continuously further written to the local audio bufferspace and the secondary audio buffer space, respectively; wherein whenthe audio and video playback controls the local audio device and thesecondary audio device to collaboratively play the audio data in themultimedia data, the processor further performs steps of: determiningwhether the local audio data and the secondary audio data outputted fromthe local audio device and the secondary audio device are synchronous;when it is determined that the local audio data and the secondary audiodata outputted from the local audio device and the secondary audiodevice are asynchronous, executing a synchronization mechanism tosynchronize the local audio data and the secondary audio data outputtedfrom the local audio device and the secondary audio device aresynchronous; wherein the step of determining whether the local audiodata and the secondary audio data outputted from the local audio deviceand the secondary audio device are synchronous further comprises:acquiring delay periods of the local audio data and the secondary audiodata outputted from the local audio device and the secondary audiodevice, respectively; and determining, according to the respective delayperiods of the local audio data and the secondary audio data outputtedfrom the local audio device and the secondary audio device, whether thelocal audio data and the secondary audio data outputted from the localaudio device and the secondary audio device are synchronous; wherein thestep of the step of executing the synchronization mechanism tosynchronize the local audio data and the secondary audio data outputtedfrom the local audio device and the secondary audio device furthercomprises: determining a difference between the delay periods of thelocal audio data and the secondary audio data outputted from the localaudio device and the secondary audio device; generating a null packethaving a corresponding size according to the difference between thedelay periods of the local audio data and the secondary audio dataoutputted from the local audio device and the secondary audio device;and writing the null packet to the local audio buffer space or thesecondary audio buffer space corresponding to the local audio device orthe secondary audio device having the smaller delay period, to cause thelocal audio device or the secondary audio device to output the nullpacket when outputting the local audio data or the secondary audio data,thereby synchronizing the local audio data and the secondary audio dataoutputted from the local audio device and the secondary audio device. 8.An audio and video playback system, comprising: an audio and videoplayback device, for playing multimedia data, the audio and videoplayback device comprising a local audio device, a processor, a memoryand a buffer unit, wherein the audio and video playback device playsboth audio and video; and a secondary audio device, connected to theaudio and video playback device; wherein the processor in the audio andvideo playback device performs steps of: allocating a local audio bufferspace and a secondary audio buffer space to the local audio device andthe secondary audio device, respectively; processing the obtainedmultimedia data to generate local audio data and secondary audio data;writing the local audio data and the secondary audio data to the localaudio buffer space and the secondary audio buffer space, respectively;and reading the local audio data and the secondary audio data bufferedin the local audio buffer space and the secondary audio buffer space tothe local audio device and the secondary audio device, respectively, tohave the local audio device and the secondary audio devicesimultaneously play the local audio data and the secondary audio data,respectively; wherein, an audio device management program is stored inthe memory of the audio and video playback device; when the audio devicemanagement program is executed, the audio and video playback devicecontrols the local audio device and the secondary audio device accordingto the audio device management program to perform a collaboratedplayback task to play audio data in the multimedia data; wherein whenthe audio and video playback device controls the local audio device andthe secondary audio device according to the audio device managementprogram to perform the collaborated playback task to play audio data inthe multimedia data; wherein the local audio buffer space and thesecondary audio buffer space are each a ring buffer space, such thatwhile the local audio data and the secondary audio data buffered in thelocal audio buffer space and the secondary audio buffer space are readto the local audio device and the secondary audio device, the localaudio data and the secondary audio data are continuously further writtento the local audio buffer space and the secondary audio buffer space,respectively; wherein when the audio and video playback controls thelocal audio device and the secondary audio device to collaborativelyplay the audio data in the multimedia data, the processor furtherperforms steps of: determining whether the local audio data and thesecondary audio data outputted from the local audio device and thesecondary audio device are synchronous; when it is determined that thelocal audio data and the secondary audio data outputted from the localaudio device and the secondary audio device are asynchronous, executinga synchronization mechanism to synchronize the local audio data and thesecondary audio data outputted from the local audio device and thesecondary audio device are synchronous; wherein the step of determiningwhether the local audio data and the secondary audio data outputted fromthe local audio device and the secondary audio device are synchronousfurther comprises: acquiring delay periods of the local audio data andthe secondary audio data outputted from the local audio device and thesecondary audio device, respectively; and determining, according to therespective delay periods of the local audio data and the secondary audiodata outputted from the local audio device and the secondary audiodevice, whether the local audio data and the secondary audio dataoutputted from the local audio device and the secondary audio device aresynchronous; wherein the step of executing the synchronization mechanismto synchronize the local audio data and the secondary audio dataoutputted from the local audio device and the secondary audio devicefurther comprises: determining a difference between the delay periods ofthe local audio data and the secondary audio data outputted from thelocal audio device and the secondary audio device; obtaining thecorresponding data size according to the difference between the delayperiods of the local audio data and the secondary audio data outputtedfrom the local audio device and the secondary audio device; anddiscarding data having the corresponding data size from the local audiobuffer space or the secondary audio buffer space corresponding to thelocal audio device or the secondary audio device having the greaterdelay period, thereby synchronizing the local audio data and thesecondary audio data outputted from the local audio device and thesecondary audio device.
 9. The audio and video playback system accordingto claim 7, wherein the audio device management program furthercomprises an audio device playback mode selection function; when theaudio device playback mode selection function is executed, the audio andvideo playback device drives the local audio device and/or the secondaryaudio device according to the selected audio device playback mode toplay the audio data in the multimedia data.
 10. The audio and videoplayback system according to claim 7, wherein the audio and videoplayback device is a television or a television system consisting of aset-top box (STB) and a television, the local audio device is a localspeaker built in the television, and the secondary audio device is anexternal acoustic enclosure connected to the television.
 11. The audioand video playback system according to claim 7, wherein the secondaryaudio device and the television are connected by means of USB wirelessconnection.